<template>
  <van-cell is-link class="myCell" center :border="bool">
    <template #title>
      <div class="title">{{title}}</div>
    </template>
    <template #default>
      <img v-if="type === 'image' && value" :src="baseUrl + value" alt="" class="img">
      <img v-else-if="type === 'image' && !value" src="@/assets/logo.png" alt="" class="img">
      <div v-else class="value">{{value}}</div>
    </template>
    <template #icon>
      <i class="iconfont" v-html="icon"></i>
    </template>
  </van-cell>
</template>

<script>
export default {
  name: 'myCell',
  props: {
    title: {
      type: String,
      default: function () {
        return ''
      }
    },
    value: {
      type: String,
      default: function () {
        return ''
      }
    },
    icon: {
      type: String,
      default: function () {
        return ''
      }
    },
    type: {
      type: String,
      default: function () {
        return ''
      }
    }
  },
  data () {
    return {
      bool: false,
      baseUrl: process.env.VUE_APP_URL
    }
  }
}
</script>

<style lang="less" scoped>
  .myCell {
    height: 55px;
    background: #ffffff;
    .title {
      padding-left: 12px;
      font-size: 14px;
      font-family: PingFangSC, PingFangSC-Regular;
      font-weight: 400;
      text-align: left;
      color: #181a39;
      line-height: 20px;
      letter-spacing: 0px;
    }
    .value {
      font-size: 14px;
      font-family: PingFangSC, PingFangSC-Regular;
      font-weight: 400;
      text-align: right;
      color: #5b5d75;
      line-height: 20px;
      letter-spacing: 0px;
    }
    .img {
      width: 40px;
      height: 40px;
      border-radius: 50%;
    }
  }
</style>
